<?php
class table{
	public $cells = array();
	public $table = array();

	public function cell($content,$options=array()){
		$optcode = "";
		if(isset($options['width'])){
			$optcode .= " width=\"".$options['width']."\"";
		}
		if(isset($options['colspan'])){
			$optcode .= " colspan=\"".$options['colspan']."\"";
		}
		if(isset($options['class'])){
			$optcode .= " class=\"".$options['class']."\"";
		}
		if(isset($options['style'])){
			$optcode .= " style=\"".$options['style']."\"";
		}
		$this->cells[] = "<td{$optcode}>{$content}</td>\n";
	}

	public function build_row(){
		$return = "<tr>\n";
		foreach($this->cells as $cell){
			$return .= $cell;
		}
		$return .= "</tr>\n";
		$this->table[] = $return;
		$this->cells = array();
	}

	public function output(){
		echo "<table>\n";
		foreach($this->table as $row){
			echo $row;
		}
		echo "</table>\n";
	}
}
?>